package StructuralPattern.DecoratorPattern;

import StructuralPattern.DecoratorPattern.Interfase.Beverage;

public class TestDecoratorPattern {
    public static void main(String[] args) {
//        //基本
//        Coffee coffee = new Coffee();
//        System.out.println(coffee.getDescription());
//        System.out.println(coffee.cost());

        //装饰者模式
        // 创建基础咖啡对象
        Beverage coffee = new Coffee();
        // 打印基础咖啡的描述和费用
        System.out.println("Description: " + coffee.getDescription()); // Output: Coffee
        System.out.println("Cost: $" + coffee.cost()); // Output: 2.00

        // 给咖啡添加牛奶装饰器
        Beverage milkCoffee = new MilkDecorator(coffee);

        // 打印添加牛奶后的咖啡描述和费用
        System.out.println("Description: " + milkCoffee.getDescription()); // Output: Coffee, Milk
        System.out.println("Cost: $" + milkCoffee.cost()); // Output: 2.50
    }
}
